package com.diandi.signature.manager.contract;

import com.diandi.signature.bean.contract.SignatureContract;

import java.io.StringReader;
import java.util.List;
import java.util.Map;

/**
* @author mwz
* @create 2017-08-23 13:11
* @version V1.0.0
* @description description
*/
public interface SignatureContractManager {

    /**
     * 查询合同消息通过用户编码及合同号
     * @param paramMap
     * @return
     */
    public SignatureContract getSignatureContractByCode(Map<String, Object> paramMap);


    /**
     * 插入合同信息
     * @param params
     * @return
     */
    public SignatureContract insertSignatureContractInfo(Map<String, String> params) throws Exception;

    /**
     * 保存中间数据
     * @param params
     * @return
     */
    public SignatureContract signatureSaveData( Map<String, String> params) throws Exception;

    /**
     * 保存中间数据
     * @param params
     * @return
     */
    public boolean insertProcessInfoData( SignatureContract signatureContract,Map<String, String> params,Integer processFlag) throws Exception;

    public SignatureContract updateProcessInfoData( SignatureContract signatureContract,Map<String, String> params,Integer processFlag ) throws Exception;

    public SignatureContract updateProData( SignatureContract signatureContract,Map<String, String> params,Integer processFlag ) throws Exception;

    /**
     * 更新业务及中间信息数据
     * @param params
     * @return
     */
    public boolean signatureErrorUpdateData(SignatureContract signatureContract,Map<String, String> params) throws Exception;


    /**
     * 更新中间数据
     * @param params
     * @return
     */
    public boolean signatureUpdateProcessData(SignatureContract signatureContract,Map<String, String> params,String processFlag) throws Exception ;

    public boolean notifySignatureUpdateProcessData(SignatureContract signatureContract, String processFlag ) throws Exception ;

    public boolean updateCompleteSignatureProcessData(SignatureContract signatureContract,Map<String, String> params,String processFlag,Map<String, String> rtnUploadMap)  ;
    /**
     * 发送业务端同步响应时保存数据
     * @param params
     * @return
     */
    public boolean receiveSignatureSaveData(SignatureContract signatureContractInfo, Map<String, String> params) throws Exception;

    /**
     * 更新合同状态和url
     * @param paramMap
     * @return
     */
    Integer updateUrlsByConNo(Map<String, String> paramMap);

    /**
     * 保存业务端上送的数据报文
     * @param params
     * @return
     */
    public boolean insertRvcPkgMsgInfo( Map<String, String> params) throws Exception;

    /**
     * 更新业务端上送的数据报文
     * @param params
     * @return
     */
    public boolean updateRvcPkgMsgInfo( Map<String, String> params) throws Exception;


    /**
     * 保存通道返回的报文的数据报文
     * @param params
     * @return
     */
    public boolean insertSendPkgMsgInfo( Map<String, String> params) throws Exception;

    /**
     * 更新通道返回的报文的数据报文
     * @param params
     * @return
     */
    public boolean updateSendPkgMsgInfo( Map<String, String> params) throws Exception;

    Integer updateBySignatureCode(Map<String, String> paramMap);


    /**
     *  记录合同、过程信息
     * @param params
     * @return
     * @throws Exception
     */
    public SignatureContract saveSignatureProcess(  Map<String, String> params) throws Exception ;

    Integer updateIsArchives(String contractCode, String isArchives);

    List<SignatureContract> queryTask(Map<String, Object> paramMap);

    String callBusiness(String code, String msg, String contractNo, String nUrl, String merchantNo);

    String callBusiness(String code, String msg, String contractNo, String dUrl, String vUrl, String nUrl, String merchantNo);
}
